<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" dir="ltr" lang="en"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
      th:with="assetBaseUrl=${@environment.getProperty('assetBaseUrl','/resources/oss')},
                isUaa=${T(org.cloudfoundry.identity.uaa.zone.IdentityZoneHolder).isUaa()},
                zoneName=${T(org.cloudfoundry.identity.uaa.zone.IdentityZoneHolder).get().getName()},
                branding=${T(org.cloudfoundry.identity.uaa.zone.IdentityZoneHolder).resolveBranding()},
                companyName=${branding.getCompanyName() ?: 'Cloud Foundry'},
                copyrightCompanyName=${branding.getCompanyName() ?: 'CloudFoundry.org Foundation, Inc. '},
                copyrightFallback=${'Copyright &#169; ' + copyrightCompanyName + ' ' + #dates.year(#dates.createNow()) + '. All Rights Reserved.'},
                copyright=${branding.getFooterLegalText() ?: copyrightFallback},
                brandingLogo=${branding.getProductLogo()},
                fallbackLogo=${isUaa ? assetBaseUrl+'/images/product-logo.png' : null},
                logo=${brandingLogo != null ? 'data:image/png;base64,'+#strings.replace(brandingLogo,T(java.lang.System).getProperty('line.separator'),'') : fallbackLogo}" >
<head>
    <title th:text="${isUaa ? companyName : zoneName}" th:inline="text"></title>
    <link href='/resources/oss/images/square-logo.png' th:with="icon=${branding.getSquareLogo()}" th:href="@{${icon != null ? 'data:image/png;base64,'+icon : (assetBaseUrl + '/images/square-logo.png')}}" rel='shortcut icon' />
    <meta charset='utf-8' />
    <meta name='author' th:content="|${companyName}|" />
    <meta name='copyright' th:content="|${copyright}|" />
    <meta name='robots' content='all' />
    <meta name='Description' content=""/>
    <meta name='keywords' content=""/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="/vendor/font-awesome/css/font-awesome.min.css" th:href="@{/vendor/font-awesome/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="/resources/oss/stylesheets/application.css" th:href="@{${assetBaseUrl}+'/stylesheets/application.css'}" rel="stylesheet"/>
    <style th:unless="${#strings.isEmpty(logo)}" th:text="'.header-image {' + (|background-image: url(@{${logo}});|) + '}'">
        .header-image {
            background-image: url(/resources/oss/images/product-logo.png);
        }
    </style>
</head>
<body>
<div class="content">
    <div class="header">
        <div layout:fragment="page-nav"></div>
        <div class="header-image"></div>
    </div>

    <div layout:fragment="page-content"></div>
    <div class="footer-spacer"></div>
</div>
<div class="footer">
    <div class="copyright"
         th:with="links=${branding.getFooterLinks()}"
         th:inline="text"
         th:title="|Version: ${@buildInfo.version}, Commit: ${@buildInfo.commitId}, Timestamp: ${@buildInfo.timestamp}, UAA: ${@buildInfo.uaaUrl}|">
         [[${copyright}]]
         <th:block th:each="link,iter : ${links}"><th:block th:if="${!iter.first}"> &mdash;</th:block> <a href="/" th:href="${link.value}">[[${link.key}]]</a></th:block>
        <div th:if="${#authentication instanceof T(org.cloudfoundry.identity.uaa.authentication.UaaAuthentication)} ">
            <div th:if="${#authentication.lastLoginSuccessTime} != null">
                Last login <span id="last_login_time"></span>
                <script type="text/javascript">
                    document.getElementById("last_login_time").innerHTML = new Date([[${#authentication.lastLoginSuccessTime}]]).toLocaleString();
                </script>
            </div>
        </div>
    </div>
</div>

<th:block th:with="code=${@environment.getProperty('analytics.code')},domain=${@environment.getProperty('analytics.domain')}">
    <th:block th:if="${code} and ${domain}">
        <script>
            (function(i, s, o, g, r, a, m) {
                i['GoogleAnalyticsObject'] = r;
                i[r] = i[r] || function() {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
                a = s.createElement(o), m = s.getElementsByTagName(o)[0];
                a.async = 1;
                a.src = g;
                m.parentNode.insertBefore(a, m)
            })(window, document, 'script',
                    '//www.google-analytics.com/analytics.js', 'ga');
        </script>
        <script th:utext="|ga('create', '${code}','${domain}');|"></script>
        <script>
            ga('send', 'pageview');
        </script>
    </th:block>
</th:block>
</body>
</html>
